Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help wanted] Improvement of Python Type Stubs - Update availaible #8111

Draft
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

Daraan
Copy link
Contributor

@Daraan Daraan commented Sep 4, 2024

Description

This PR is the continuation of #7787 that added type hints for the carla package.

This PR contains:

  • added carla.Rss* classes
  • added weak carla.ad type hints; also they are only included in the rss build. This needs modification of the setup and some cleaning
  • further fixes and improvements

How can you contribute:

Carla package
  • testing of the carla type hints and extending where necessary. Property setters and inplace setters are likely missing.
    You can use ruff and
     ruff check PythonAPI/carla/source/carla --select ANN --ignore ANN101,ANN102
    Use --exclude *ad/rss,*ad/map to exclude the SyntaxError from these two files while they are not addressed or the whole ad subpackage.
ad subpackage
  • Finishing type stubs for the ad subpackage.
    • add missing global attributes and functions
    • cleaning
    • overloads and property signatures

Important

The type stubs for the ad library are only minimally done there are many things missing (top-level functions & attributes), wrong (e.g. overloads) or incomplete. I will not continue the work on the ad subpackage.
On my repo I have a tag with alternative type stubs for ad that can be used to complement the ones in this PR. Those are more complete but lack function signatures and types: https://github.com/Daraan/LunaticAI-Driver-for-CARLA-Simulator/releases/tag/deleted-Alternative-ad-type-stubs

  • Solve setup.py not to include rss files into non-rss build (happens when rebuilding without cleaning build dir).
    If someone has a better idea how to prevent copying of the source/carla/ad/ if one does a normal build after an rss build please feel to share your ideas. I am not sure how far we can go with MANIFEST.in files. Or doing a more thorough cleanup before.
    Currently these files will be removed instead keeping them around.

Further contributions

Feel free to make PRs against my fork https://github.com/Daraan/CARLA-Simulator-Fork-DebianFix/tree/type-hinting-to-dev to the type-hinting-to-dev branch.

Where has this been tested?

  • Platform(s): Ubuntu 22.04
  • Python version(s):
    • 2.7 RSS build fails, without OK
    • 3.10with and without RSS

Possible Drawbacks


This change is Reviewable

Copy link

update-docs bot commented Sep 4, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update our CHANGELOG.md based on your changes.

@Daraan Daraan force-pushed the type-hinting-to-dev branch 2 times, most recently from 1f0ca19 to b7df53f Compare September 6, 2024 17:29
@Daraan Daraan force-pushed the type-hinting-to-dev branch 2 times, most recently from 77bb709 to 640c076 Compare September 18, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant